/*************************************************************************
 *                                                                       *
 * This file is part of the FreeMAPs distribution.  For full copyright   *
 * information, see COPYRIGHT and COPYING.LESSER.                        *
 *                                                                       *
 * Author:           sqbang                                              *
 * Email:            sqbang@ustc.edu                                     *
 * Date:             2015.07.10                                          *
 * Description:      SimpleRegion that has a unitary material            *
 *                                                                       *
 *************************************************************************/

#ifndef FreeMAPs_include_COMMON_regn_SimpleRegion_h
#define FreeMAPs_include_COMMON_regn_SimpleRegion_h

#include "FreeMAPsConfig.h"

//COMMON headers
#include "COMMON/base/StateIndicator.h"
#include "COMMON/attr/Attribute.h"

namespace FreeMAPs
{

//forward declaration

/**
 * @brief SimpleRegion is a base object in simulation.
 * each region has a unitary material.
 * different region may have same material.
 * different region CAN NOT overlapped.
 */
class SimpleRegion : public StateIndicator
{
public:

    SimpleRegion (
        const std::string& parent_name,
        const std::string& region_name,
        const bool use_structured_mesh);
    //use_structured_mesh may don't used, because there only to get down infomation
    //    _body
    //    {
    //       attribute_name = "attr_Al"
    //    }
    ~SimpleRegion();

public:

    inline bool
    use_structured_mesh() const;

    inline const std::string&
    get_simple_region_name() const;

    inline bool
    has_attribute() const;

    inline const Attribute*
    get_attribute() const;

    inline void
    set_attribute(
            const std::string& attr_name);

    inline const std::string
    get_attribute_name() const;


public:
    void
    get_from_input (
        const InputDatabase* db);

    friend std::ostream&
    operator << (
        std::ostream& os,
        const SimpleRegion& rhs);

private:

    typedef StateIndicator Parent;

    /*
     * in structured mesh, the region is described by level set.
     * in unstructured mesh, the region is described by elem group.
     */
    bool d_use_structured_mesh;

    /*
     * the pointer to the attribute that the region's attribute owner.
     * this object does NOT manager the memory of d_attribute.
     */
    const Attribute* d_attribute;

private:

    DISALLOW_COPY_AND_ASSIGN (SimpleRegion);
};

}

#include "COMMON/regn/SimpleRegion.inl"

#endif
